<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@page contentType="text/html;charset=utf-8"%>
<%@page isELIgnored="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>当当图书 – 全球最大的中文网上书店</title>
		<link href="${pageContext.request.contextPath}/css/book.css" rel="stylesheet" type="text/css" />
		<link href="${pageContext.request.contextPath}/css/second.css" rel="stylesheet" type="text/css" />
		<link href="${pageContext.request.contextPath}/css/secBook_Show.css" rel="stylesheet" type="text/css" />
		<link href="${pageContext.request.contextPath}/css/list.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.11.1.js"></script>
        <script type="text/javascript">
            $(function () {

                $("img[name='img2']").click(function () {
                    var id=$(this).next().html()
                    //$(this).prop("src","${pageContext.request.contextPath}/cart/cart_addCart?bookid="+id)
                    $.ajax({
                        url:"${pageContext.request.contextPath}/addCart.do",
                        data:"bookid="+id,
                        success:function(result){
                            if(result=='loseToken'){
                                //跳转到登录页面
								window.location="${pageContext.request.contextPath}/user/login_form.jsp"
                            }
                        }
                    })
                    var that=$(this);
                    window.setTimeout(function () {
                        that.prop("src","${pageContext.request.contextPath}/images/load.gif")
                    },500)
                    window.setTimeout(function () {
                        that.prop("src","${pageContext.request.contextPath}/images/label3.gif")
                    },1000)
                    window.setTimeout(function () {
                        that.prop("src","${pageContext.request.contextPath}/images/buttom_goumai.gif")
                    },1500)
                })
            })
        </script>
	</head>
	<body>
		&nbsp;

		<!-- 头部开始 -->
		<%@include file="../common/head.jsp"%>
		<!-- 头部结束 -->

		<div style="width: 962px; margin: auto;">
			<a href="#"><img src="${pageContext.request.contextPath}/images/default/book_banner_081203.jpg" border="0" /> </a>
		</div>
		<div class='your_position'>
			您现在的位置:&nbsp;
			<a href='${pageContext.request.contextPath}/main.do'>当当图书</a> &gt;&gt;
			<c:if test="${category_type==1}">
				<font style='color: #cc3300'><strong>${category_name}</strong> </font>
			</c:if>
			<c:if test="${category_type==2}">
				<a href="${pageContext.request.contextPath}/selectCateByFirstLevel.do?id=${category.category_id}&category_type=${category.category_type}&category_name=${category.category_name}">${category.category_name}</a>
				&gt;&gt;<font style='color: #cc3300'><strong>${category_name}</strong> </font>
			</c:if>
		</div>

		<div class="book">

			<!--左栏开始-->
			<div id="left" class="book_left">
				<div id="__fenleiliulan">
					<div class=second_l_border2>
						<h2>
							分类浏览
						</h2>
						<ul>
							<li>
								<div>
									<div class=second_fenlei>
										&middot;全部&nbsp;(23)
									</div>
								</div>
							</li>
							<div class="clear"></div>
						<c:forEach items="${categoryList}" var="cate">
							<!--2级分类开始-->
							<li>
								<div>
									<div class=second_fenlei>
										&middot;
									</div>
									<div class=second_fenlei>
										<a href="${pageContext.request.contextPath}/selectCateByTwoLevel.do?id=${cate.category_id}&category_type=${cate.category_type}&category_name=${cate.category_name}">${cate.category_name} &nbsp;${cate.count}</a>
									</div>
								</div>
							</li>
						    <div class="clear"></div>
						</c:forEach>

							<!--2级分类结束-->
							
							<li>
								<div></div>
							</li>
						</ul>
					</div>
				</div>
			</div>

			<!--左栏结束-->

			<!--中栏开始-->
			<div class="book_center">

				<!--图书列表开始-->
				<div id="divRight" class="list_right">

					<div id="book_list" class="list_r_title">
						<div id="divTopPageNavi" class="list_r_title_text3">
							<!--分页导航开始-->
							<div class='list_r_title_text3a'>
							<c:if test="${pageNum>1}">
								<a name=link_page_next
									<c:if test="${category_type==1}">
								   href="${pageContext.request.contextPath}/selectCateByFirstLevel.do?id=${id}&category_type=${category_type}&category_name=${category_name}&pageNum=${pageNum-1}"
									</c:if>
									<c:if test="${category_type==2}">
										href="${pageContext.request.contextPath}/selectCateByTwoLevel.do?id=${id}&category_type=${category_type}&category_name=${category_name}&pageNum=${pageNum-1}"
									</c:if>
								>
							</c:if>
								<img src='${pageContext.request.contextPath}/images/page_up.gif' /> </a>
							</div>

							<div class='list_r_title_text3a'>
								<img src='${pageContext.request.contextPath}/images/page_up_gray.gif' />
							</div>

							<div class='list_r_title_text3b'>
								第${pageNum}页/共${totalPage}页
							</div>
							
							<div class='list_r_title_text3a'>
								<c:if test="${pageNum<totalPage}">
								<a name=link_page_next
										<c:if test="${category_type==1}">
											href="${pageContext.request.contextPath}/selectCateByFirstLevel.do?id=${id}&category_type=${category_type}&category_name=${category_name}&pageNum=${pageNum+1}"
										</c:if>
										<c:if test="${category_type==2}">
											href="${pageContext.request.contextPath}/selectCateByTwoLevel.do?id=${id}&category_type=${category_type}&category_name=${category_name}&pageNum=${pageNum+1}"
										</c:if>
								>
								</c:if>
									<img src='${pageContext.request.contextPath}/images/page_down.gif' /> </a>
							</div>
			
							<div class='list_r_title_text3a'>
								<img src='${pageContext.request.contextPath}/images/page_down_gray.gif' />
							</div>
							<!--分页导航结束-->
						</div>
					</div>
					
					<!--商品条目开始-->

						<div class="list_r_line"></div>
						<div class="clear"></div>
					<c:forEach items="${bookList}" var="book">
						<div class="list_r_list">
							<span class="list_r_list_book"><a name="link_prd_img" href='${pageContext.request.contextPath}/selectOne.do?id=${book.book_id}'>
								<img src="${pageContext.request.contextPath}/productImages/${book.product_image}" /> </a> </span>
							<h2>
								<a name="link_prd_name" href='${pageContext.request.contextPath}/selectOne.do?id=${book.book_id}'>${book.book_name}</a>
							</h2>
							<h3>
								顾客评分：${book.custome_score}
							</h3>
							<h4 class="list_r_list_h4">
								作 者:
								<a href='#' name='作者'>${book.author}</a>
							</h4>
							<h4>
								出版社：
								<a href='#' name='出版社'>${book.press}</a>
							</h4>
							<h4>
								出版时间：<fmt:formatDate value="${book.print_date}" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate>
							</h4>
							<h5>
								内容简介：${book.messages}
							</h5>
							<div class="clear"></div>
							<h6>
								<span class="del">定价：${book.book_price}</span>
								<span class="red">当当价:${book.dangPrice}</span>
								节省：￥19
							</h6>
							<span class="list_r_list_button">

							<img name="img2" src='${pageContext.request.contextPath}/images/buttom_goumai.gif' /><span style="display: none;">${book.book_id}</span>
						</div>
						<div class="clear"></div>
					</c:forEach>

						<!--商品条目结束-->

					<div class="clear"></div>
					<div id="divBottomPageNavi" class="fanye_bottom">
					</div>

				</div>
				<!--图书列表结束-->

			</div>
			<!--中栏结束-->
			<div class="clear"></div>
		</div>

		<!--页尾开始 -->
		<%@include file="../common/foot.jsp"%>
		<!--页尾结束 -->
	</body>
</html>
